import { defineStore } from 'pinia'
import { reactive} from 'vue'
import {getUserInfo} from '@/api/disk/user'

function initState(){
  return {
    userInfo:{}, 
  }
}

export const userStore = defineStore('user', (a) => {
      const state=reactive(initState())
      
      async function getUser(){
        const data={
            userId: parseInt(localStorage.getItem('userId'))
        }
        const res= await  getUserInfo(data);
        state.userInfo=res.data
      }
      
      return {
        state,
        getUser
      }
})